﻿using System;
using System.Collections;
using System.Linq;
using System.Linq.Expressions;
using System.Collections.Generic;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SL.WorkfowDesigner.Designer
{
    public class DesignerZIndexManager
    {
        private int startIndex = 0;
        private int endIndex = 0;

        private Dictionary<int, UIElement> zIndexElements = new Dictionary<int, UIElement>();

        public int StartIndex
        {
            get { return startIndex; }
        }

        public int EndIndex
        {
            get { return endIndex; }
        }

        public int AddElement(UIElement uiElement)
        {
            if (this.zIndexElements.Count <= 0)
                return StartIndex;
            int maxIndex = this.zIndexElements.Keys.Max();
            this.zIndexElements.Add(maxIndex + 1, uiElement);
            return this.zIndexElements.Keys.Max();
        }

        //public int GetElementIndex(UIElement uiElement)
        //{
        //    return this.zIndexElements.Select(p => (p.Value.Equals(uiElement))).FirstOrDefault().;
        //}

        public DesignerZIndexManager(int startIndex, int endIndex)
        {
            this.startIndex = startIndex;
            this.endIndex = endIndex;
        }


    }
}
